package cn.hou.java.designpattern._20commod;
//客户端
public class Client {
	public static void main(String[] args) {
		//助理,调用命令,设置或者取消命令
		Assistant assistant=new Assistant();
		Worker worker = new Worker();//命令实际执行者
		//创建需要执行的命令
		BuyCommand buyCommand = new BuyCommand(worker);
		SailCommand sailCommand = new SailCommand(worker);
		//设置命令
		assistant.setCommand(buyCommand);
		assistant.setCommand(sailCommand);
		assistant.excute();//执行
		System.out.println("------------");
		//取消买命令
		assistant.cancelCommand(sailCommand);
		assistant.excute();//执行
	}
}
